package edu.tjhsst.androidIntranet.db;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;

public class NewsProvider extends ContentProvider {

	private static final UriMatcher newsUriMatcher;
	public static final String NEWS_AUTHORITY = "edu.tjhsst.androidIntranet.db.news";
	private static final int NEWS = 0;
	private static final int NEWS_ENTRY = 1;

	static {
		newsUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
		newsUriMatcher.addURI(NEWS_AUTHORITY, "newsEntries", NEWS);
		newsUriMatcher.addURI(NEWS_AUTHORITY, "newsEntries/*", NEWS_ENTRY);
	}

	@Override
	public int delete(Uri arg0, String arg1, String[] arg2) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String getType(Uri uri) {
		Log.d("NewsProvider", "Returning Type");
		switch(newsUriMatcher.match(uri)) {
		case NEWS:
			//return "vnd.android.cursor.dir/vnd.android.cursor.dir/vnd.tjhsst.newsEntry";
			return "vnd.android.cursor.dir/vnd.tjhsst.newsEntry";
		case NEWS_ENTRY:
			return "vnd.android.cursor.item/vnd.tjhsst.newsEntry";
		}
		return null;
	}

	@Override
	public Uri insert(Uri arg0, ContentValues arg1) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean onCreate() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public Cursor query(Uri arg0, String[] arg1, String arg2, String[] arg3,
			String arg4) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
		// TODO Auto-generated method stub
		return 0;
	}

}
